/*
 * This file is part of Super Luigi Bros.
 * Super Luigi Bros is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * Super Luigi Bros is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Super Luigi Bros.  If not, see <http://www.gnu.org/licenses/>.
 */

package luigibros.logic;

import java.util.HashMap;
import java.util.Map;

import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlEnumValue;
import javax.xml.bind.annotation.XmlType;

@XmlType(name = "luigi_type")
@XmlEnum
public enum LuigiType{
        @XmlEnumValue("default")
        DEFAULT(0),
        @XmlEnumValue("strong")
        STRONG(1),
        @XmlEnumValue("fire")
        FIRE(2),
        @XmlEnumValue("super")
        SUPER(3),
        @XmlEnumValue("changing")
        CHANGING(4);
        
        private byte strengthLevel;
        private double speed;
        private static final Map<Byte, LuigiType> map;
        static {
                        map = new HashMap<Byte, LuigiType>();
                        LuigiType[] list = values();
                        for(LuigiType type : list)
                                map.put(new Byte(type.toByte()), type);
        }
        
        //attributes of a Luigi
        private boolean canFire;
        private boolean canDie;
        
        private LuigiType (int strengthLevel){
                this.strengthLevel = (byte) strengthLevel;
                switch(strengthLevel)
                {
                case 0:         		speed = .25;
                                        canFire = false;
                                        canDie = true;
                        break;
                case 1:
                                        speed = .25;
                                        canFire = false;
                                        canDie = false;
                        break;
                case 2: 		        speed = .50;
                                        canFire = false;
                                        canDie = false;
                        break;
                case 3:         		speed = .50;
                                        canFire = true;
                                        canDie = false;
                        break;
                case 4: 		        speed = .60;
                                        canFire = true;
                                        canDie = false;
                        break;
                }
        }
        
        public byte             toByte()                        {return strengthLevel;}
        public boolean canFire()                        {return canFire;}
        public double speed()                           {return speed;}
        public boolean canDie()                         {return canDie;}
        public String getState()                        {return this.toString() + ".toString()";}
}

